import React,{Component} from 'react';
import{
Button, ScrollView,StyleSheet,Image,View,Text,ListView
} from 'react-native';
import { SafeAreaView, StackNavigator, TabNavigator } from 'react-navigation';
//导入异步获取数据
import NetUitl from '../../Until/fetchcomponent';
//设置工具列表页面
//class AllContactsScreen extends Component
class TooScreen extends Component{
  constructor(props){
    super(props);
    var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2,
      sectionHeaderHasChanged:(s1,s2) =>s1 !== s2,
    });
    this.state = {
    dataSource: ds,
    data:{a:['row 1', 'row 2','row 3','row 4','row 5'],b:['row 1', 'row 2','row 3','row 4','row 5']}
    };
  }
    componentDidMount() {
    //http://192.168.3.50/public/caiji/Appfetch/get?id=3106
    const geturl= 'http://192.168.3.50/public/caiji/Appfetch/get?id=3103'
    const posturl = 'http://192.168.3.50/public/caiji/Appfetch/post'
    let params = {'id':'3103'}
    console.log(JSON.stringify(params))
    // NetUitl.get(geturl,'',function(data){
    //   //alert(JSON.stringify(data))
    // })
    // NetUitl.post(posturl,params,'',function(data){
    //   //alert(JSON.stringify(data))
    // })
  }
  render(){
    const sources = this.state.dataSource.cloneWithRowsAndSections(this.state.data)
    return(
      <ScrollView>
      <SafeAreaView forceInset={{ horizontal: 'always' }}>
        <ListView
          style={{marginTop:20}}
          dataSource={sources}
          renderRow = {(rowData,sectionId,rowId) => <Text>{sectionId}:{rowData}</Text>}
          showVerticalScrollIndicator={false} 
        />
      </SafeAreaView>
    </ScrollView>
    );
    
  }
}
export default TooScreen;